package com.ruoyi.transport.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.transport.mapper.TTransportPlanMapper;
import com.ruoyi.transport.domain.TTransportPlan;
import com.ruoyi.transport.service.ITTransportPlanService;

/**
 * 运输计划Service业务层处理
 * 
 * @author wzy
 * @date 2024-11-18 13:29:10
 */
@Service
public class TTransportPlanServiceImpl implements ITTransportPlanService 
{
    @Autowired
    private TTransportPlanMapper tTransportPlanMapper;

    /**
     * 查询运输计划
     * 
     * @param transportPlanId 运输计划主键
     * @return 运输计划
     */
    @Override
    public TTransportPlan selectTTransportPlanByTransportPlanId(Long transportPlanId)
    {
        return tTransportPlanMapper.selectTTransportPlanByTransportPlanId(transportPlanId);
    }

    /**
     * 查询运输计划列表
     * 
     * @param tTransportPlan 运输计划
     * @return 运输计划
     */
    @Override
    public List<TTransportPlan> selectTTransportPlanList(TTransportPlan tTransportPlan)
    {
        return tTransportPlanMapper.selectTTransportPlanList(tTransportPlan);
    }

    /**
     * 新增运输计划
     * 
     * @param tTransportPlan 运输计划
     * @return 结果
     */
    @Override
    public int insertTTransportPlan(TTransportPlan tTransportPlan)
    {
        tTransportPlan.setCreateTime(DateUtils.getNowDate());
        return tTransportPlanMapper.insertTTransportPlan(tTransportPlan);
    }

    /**
     * 修改运输计划
     * 
     * @param tTransportPlan 运输计划
     * @return 结果
     */
    @Override
    public int updateTTransportPlan(TTransportPlan tTransportPlan)
    {
        tTransportPlan.setUpdateTime(DateUtils.getNowDate());
        return tTransportPlanMapper.updateTTransportPlan(tTransportPlan);
    }

    /**
     * 批量删除运输计划
     * 
     * @param transportPlanIds 需要删除的运输计划主键
     * @return 结果
     */
    @Override
    public int deleteTTransportPlanByTransportPlanIds(Long[] transportPlanIds)
    {
        return tTransportPlanMapper.deleteTTransportPlanByTransportPlanIds(transportPlanIds);
    }

    /**
     * 删除运输计划信息
     * 
     * @param transportPlanId 运输计划主键
     * @return 结果
     */
    @Override
    public int deleteTTransportPlanByTransportPlanId(Long transportPlanId)
    {
        return tTransportPlanMapper.deleteTTransportPlanByTransportPlanId(transportPlanId);
    }

    /**
     * 查询运输计划
     *
     * @param transportPlanNumber 运输计划编号
     * @return 运输计划
     */
    @Override
    public TTransportPlan selectTTransportPlanByTransportPlanNumber(String transportPlanNumber)
    {
        return tTransportPlanMapper.selectTTransportPlanByTransportPlanNumber(transportPlanNumber);
    }
    /**
     * 修改运输计划，已发车数，剩余重量，剩余件数
     *
     * @param transportPlanNumber 运输计划
     * @return 结果
     */
    @Override
    public int updateTTransportPlanDespatchWeightPieceByNumber(String transportPlanNumber)
    {
        return tTransportPlanMapper.updateTTransportPlanDespatchWeightPieceByNumber(transportPlanNumber);
    }

}
